var coordDisplayMode = "user";
var updateTime = "11/29/11 1:01pm"
var gpsRegex = /(-?\d+\.?\d*),\s?(-?\d+\.?\d*)/g

function geoLink(lat, lng, name){
	var geo = $('<a class="locationLink">'+name+'</a>').click({"lat": lat, "lng":lng}, function(a) {$(this).css("color", "purple"), goToLatLng(a.data.lat, a.data.lng);});
	return geo;
}

function popupCurrentLocation(){
	var locationDisplayText;
	if (coordDisplayMode == "dev")
		locationDisplayText = "{\na:\""+gCurrentClientPos.y+"\",\nb:\""+gCurrentClientPos.x+"\",\nname:\""+gCurrentCity.name+"\",\ncount:1,\nclassname:\"new\",\n},";
	else
		locationDisplayText = "loc:"+gCurrentClientPos.y+","+gCurrentClientPos.x
	showPopupAlert("Current Location", locationDisplayText, "Copy", "OK", null, function(){copyToClipboard(locationDisplayText);});
}

function copyToClipboard(text){
	window.prompt("Copy to clipboard:", text);
}

$(document).ready(function(){
	frontyard && (window.goHome = function(){ 
		var a = UserCharacter.currentUserCharacter();
		goToLatLng(a.getHousePoint().y, a.getHousePoint().x);
	});
	$("#recenterButton").click(popupCurrentLocation);
	$("#locationButton").click(popupCurrentLocation);
});